import http from '@/util/axios'
import type { Res, TPage } from '../types'
import * as T from './types'

export enum ApiPath {
  List = '/api/identity/org/list', // 组织列表
}

// 获得列表
export function getList(page?: TPage, filter?: any, ): Promise<Res<T.TOrgItem[]>> {
  const params: {[key:string]: any} = {
    ...{
      page: 1,
      page_size: 10,
    },
    ...page, ...filter
  }
  const paramArr: string[] = []
  for(const key in params) {
    paramArr.push(`${key}=${params[key]}`)
  }
  return http.get(`${ApiPath.List}?${paramArr.join('&')}`, {})
}